public class Test1 {
    public static void main(String[] args) {
        PriorityQueue pq = new PriorityQueue();

        // Test createHeap
        int[] array = {9, 4, 7, 1, 3};
        pq.createHeap(array);

        // Test push
        pq.push(6);
        pq.push(8);
        pq.push(2);

        // Test peekHeap
        System.out.println("Peek: " + pq.peekHeap());

        // Test pollHeap
        while (!pq.isEmpty()) {
            System.out.println("Poll: " + pq.peekHeap());
            pq.pollHeap();
        }

        // Test isFull and push
        System.out.println("Is Full: " + pq.isFull());
        for (int i = 0; i < 15; i++) {
            pq.push(i);
        }

        // Test isEmpty and pollHeap
        System.out.println("Is Empty: " + pq.isEmpty());
        while (!pq.isEmpty()) {
            System.out.println("Poll: " + pq.peekHeap());
            pq.pollHeap();
        }
    }

   class TestCompare {
        public void main2(String[] args) {
            int a = 10;
            int b = 20;
            System.out.println(a > b);
            System.out.println(a < b);
            System.out.println(a == b);
            char c1 = 'A';
            char c2 = 'B';
            System.out.println(c1 > c2);
            System.out.println(c1 < c2);
            System.out.println(c1 == c2);
            boolean b1 = true;
            boolean b2 = false;
            System.out.println(b1 == b2);
            System.out.println(b1 != b2);
        }
    }

    // Object中equal的实现，可以看到：直接比较的是两个引用变量的地址
    public boolean equals(Object obj) {
        return (this == obj);
    }

    public interface Comparable<E> {
        // 返回值:
        // < 0: 表示 this 指向的对象小于 o 指向的对象
        // == 0: 表示 this 指向的对象等于 o 指向的对象
        // > 0: 表示 this 指向的对象大于 o 指向的对象
        int compareTo(E o);
    }

    public interface Comparator<T> {
        // 返回值:
        // < 0: 表示 o1 指向的对象小于 o2 指向的对象
        // == 0: 表示 o1 指向的对象等于 o2 指向的对象
        // > 0: 表示 o1 指向的对象等于 o2 指向的对象
        int compare(T o1, T o2);
    }
}

